/**弹出提示框方法
 * type:success,warning,info,danger
 * container:一个jquery对象
 * context：提示信息
 * <div id="myAlert" class="alert alert-success" >
 * <a href="#" class="close" data-dismiss="alert">&times;</a>
 *	<strong>成功！</strong>结果是成功的。
 *   </div>
 * 
 * **/
function myAlert (type,context,container){
	var title = "未知";
	if(type=="success"){
		title = "成功！";
	}else if(type=="warning"){
		title = "警告！";
	}else if(type=="info"){
		title = "信息！";
	}else if(type=="danger"){
		title = "失败！";
	}
	container.append("<div class='alert alert-"+type+"'> " +
			"<a href='#' class='close' data-dismiss='alert'>&times;</a>"+
			"<strong>"+title+"</strong>"+context+"</div>");
	setTimeout(removeAlert,800);
	function removeAlert(){
		container[0].innerHTML="";
	}
}
//失败
function danger(content){
	 BootstrapDialog.show({
			title:"提示",
			message:content,
			type : BootstrapDialog.TYPE_DANGER,
			buttons : [ {
				icon : 'glyphicon glyphicon-check',
				label : '确定',
				cssClass : 'btn-primary',
				autospin : true,
				action : function(dialogRef) {
					dialogRef.close();
				}
			} ]
		});
}
//成功
function success(content){
	 BootstrapDialog.alert({
		title : '提示',
		message : content,
		type : BootstrapDialog.TYPE_SUCCESS
	});
	setTimeout(function() {
		BootstrapDialog.closeAll();
	}, 800);
}
//警告
function warning(content){
	BootstrapDialog.show({
		title:"提示",
		message:content,
		type : BootstrapDialog.TYPE_WARNING,
		buttons : [ {
			icon : 'glyphicon glyphicon-check',
			label : '确定',
			cssClass : 'btn-primary',
			autospin : true,
			action : function(dialogRef) {
				dialogRef.close();
			}
		} ]
	});
}
//信息
function info(content){
	 var t=BootstrapDialog.alert({
		title : '提示',
		message : content,
		type : BootstrapDialog.TYPE_INFO
	});
	setTimeout(function() {
		t.close();
	}, 800);
}

//时间格式化工具
Date.prototype.Format = function (fmt) { 
    var o = {
        "M+": this.getMonth() + 1, //月份 
        "d+": this.getDate(), //日 
        "h+": this.getHours(), //小时 
        "m+": this.getMinutes(), //分 
        "s+": this.getSeconds(), //秒 
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
        "S": this.getMilliseconds() //毫秒 
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
};